package com.atguigu.utils.properties

import java.io.InputStreamReader
import java.util.Properties

/**
 * 获取配置文件的工具类
 *
 * @author WangJX
 * @date 2019/11/26 14:02 
 * @version 1.0
 */
object PropertiesUtil {
  def load(propertieName: String): Properties = {
    val prop=new Properties();
//    prop.load(new InputStreamReader(Thread.currentThread().getContextClassLoader.getResourceAsStream(propertieName) , "UTF-8"))
    prop.load(new InputStreamReader(getClass.getClassLoader.getResourceAsStream(propertieName) , "UTF-8"))
//    prop.load(PropertiesUtil.getClass.getClassLoader.getResourceAsStream("propertieName"))
    prop
  }

  def main(args: Array[String]): Unit = {
    val properties: Properties = PropertiesUtil.load("config.properties")
    println(properties)
  }


}
